<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\api\controller;

/**
 * 公共基础接口控制器
 */
class Common extends ApiBase
{
    /**
     * 微信授权登录
     */
    public function wxLogin(){
        return $this->apiReturn($this->logicCommon->wxLogin($this->param));
    }
    /**
     * 微信注册登录
     */
    public function wxRegisterLogin(){
        return $this->apiReturn($this->logicCommon->wxRegisterLogin($this->param));
    }
    /**
     * 登录接口
     */
    public function logins()
    {
        return $this->apiReturn($this->logicCommon->logins($this->param));
    }
	/**
     * 收款账号
     */
	public function moneyConfig(){
		$info=db('ad')->where('catid',5)->value('cover_id');
		$str=get_picture_url($info);
		return  $this->apiReturn($str);
	}
	/**
     * 版本升级
     */
	public function getVersion(){
		$info=db('version')->find();
		$info['Android']=get_file_url($info['file_id']);
		$info['ios']=get_file_url($info['file_ids']);
		return  $this->apiReturn($info);
	}
	/**
     * 充值列表
     */
	public function czList(){
		return $this->apiReturn($this->logicCommon->czList($this->param));
	}
	/**
     * 充值
     */
	public function rechargeAdd(){
		return $this->apiReturn($this->logicCommon->rechargeAdd($this->param));
	}
	/**
     * 收款地址
     */
	public function addressList(){
		$arr=parse_config_array('addressList');
		$a=[];
		$i=0;
		foreach($arr as $k=>$v){
			$a[$i]['key']=$k;
			$a[$i]['value']=$v;
			$i++;
		}
		return $this->apiReturn($a);
	}
    /**
     * 邮件发送
     */
    public function emailSend()
    {
        return $this->apiReturn($this->logicCommon->emailSend($this->param));
    }
    /**
     * 热门搜索
     */
    public function checkInvitation()
    {
        return $this->apiReturn($this->logicCommon->checkInvitation($this->param));
    }
    /**
     * 热门搜索
     */
    public function hotList()
    {
        $arr=explode('/',config('hotWords'));
        return $this->apiReturn($arr);
    }
    /**
     * 地址列表
     */
    public function regionList()
    {
        return $this->apiReturn($this->logicCommon->regionList($this->param));
    }
    /**
     * 开关接口
     * 1开启 0关闭
     */
    public function isOpen()
    {
        $open=config('isOpen');
        return $this->apiReturn(intval($open));
    }
    /**
     * 登录接口
     */
    public function login()
    {
        return $this->apiReturn($this->logicCommon->login($this->param));
    }
    /**
     * 手机登录
     */
    public function checkLogin()
    {
        return $this->apiReturn($this->logicCommon->checkLogin($this->param));
    }
    /**
     * 发送短信
     */
    public function send()
    {
        
        return $this->apiReturn($this->logicCommon->send($this->param));
    }
	/**
     * 注册
     */
    public function register()
    {
        
        return $this->apiReturn($this->logicCommon->register($this->param));
    }
    /**
     * 修改密码接口
     */
    public function changePassword()
    {
        
        return $this->apiReturn($this->logicCommon->changePassword($this->param));
    }
    /**
     * 找回密码接口
     */
    public function getPassword()
    {
        
        return $this->apiReturn($this->logicCommon->getPassword($this->param));
    }
    
	/**
     * API详情
     */
    public function getApiKey()
    {
		return $this->apiReturn(array('API_KEY'=>API_KEY));
	}
	/**
     * 查询地址
     */
    public function searchRegion()
    {
		return $this->apiReturn($this->logicCommon->searchRegion($this->param));
	}
}
